<%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
<!-- #include file = "core.asp" -->
<%
	var _system = $('system');
	var _database = $('database');
	_database.path = "database/#database.mdb";
	
	var _action = _system.read('action');
	if (_action == 'save') {
		var _title = _system.read('title');
		var _name = _system.read('name');
		var _telephone = _system.read('telephone');
		var _email = _system.read('email');
		var _content = _system.read('content');
		
		var _sql = 'insert into [Guestbook] ([Title], [Name], [Telephone], [Email], [Content]) values (\'' + _title + '\', \'' + _name + '\', \'' + _telephone + '\', \'' + _email + '\', \'' + _content + '\')';
		//Response.Write(sql);
		//Response.End();
		_database.execute(_sql);
		
		_system.write(_system.html('留言成功!', _system.script('alert(\'留言成功!\');history.go(-1);')));
		
	}
	else {
		var _template = $('template');
		_system.write(_template.render());
	}
%>